package jianzhiOffer;

import java.util.ArrayList;
import java.util.List;

public class num57_2 {
    public int[][] findContinuousSequence(int target) {
        int left = 1;
        int rigth= 1;
        int sum = 0;
        List<int[]> res = new ArrayList<>();
        while(left <= target / 2) {
            if(sum < target) {
                sum += rigth;
                rigth ++;
            }else if(sum > target) {
                sum -= left;
                left ++;
            }else {
                int[] arr = new int[rigth - left];
                for(int i = left;i < rigth;i ++) {
                    arr[i - left] = i;
                }
                res.add(arr);
                sum -= left;
                left ++;
            }
        }
        return res.toArray(new int[res.size()][]);
    }
}
